/**
 *
 */
package jp.seraph.same.view.cui;

import jp.seraph.cui.AbstractData;
import jp.seraph.cui.InternalConsole;
import jp.seraph.cui.SystemNodeType;
import jp.seraph.same.controller.MotionElementController;
import jp.seraph.same.model.MotionElementModel;

/**
 *
 *
 */
public class MotionElementData extends AbstractData {

    /**
     * @param aParent
     * @param aConsole
     */
    public MotionElementData(MotionSessionData aParent, InternalConsole aConsole, String aElementName, MotionElementController aController, MotionElementModel aModel) {
        super(aParent, aConsole);

        mController = aController;
        mModel = aModel;
    }

    private MotionElementController mController;
    private MotionElementModel mModel;

    /**
     *
     * @see jp.seraph.cui.Data#getData()
     */
    public String getData() {
        return "MotionElement";
    }

    /**
     *
     * @see jp.seraph.cui.SystemNode#getName()
     */
    public String getName() {
        return mModel.getName();
    }

    /**
     *
     * @see jp.seraph.cui.SystemNode#getType()
     */
    public SystemNodeType getType() {
        return MotionElementDataType.getInstance();
    }

    /**
     *
     * @see jp.seraph.cui.SystemNode#isRoot()
     */
    public boolean isRoot() {
        return false;
    }

    /**
     *
     * @see jp.seraph.cui.SystemNode#setName(java.lang.String)
     */
    public void setName(String aName) {
        mController.rename(aName);
    }

    public void setBasePose(String aPoseName){
        mController.setBasePose(aPoseName);
    }

    public void selectJoint(String aId){
        mController.selectJoint(aId);
    }

    public void deselectJoint(String aId){
        mController.deselectJoint(aId);
    }

    public void setTiming(int aTiming){
        mController.setStartTiming(aTiming);
    }

    public void setConditionElementName(String aNewName){
        mController.setConditionElementName(aNewName);
    }

    public MotionElementModel getElement(){
        return mModel;
    }

    @Override
    public void delete() {
        super.delete();
        mController.delete();
    }
}
